<?php
require_once('Zend/View/Abstract.php');

class Kbs_View_Smarty extends Zend_View_Abstract
{
    private $_smarty = null;

    public function __construct($data = array())
    {
        parent::__construct($data);
        $config = Kbs::initConfig('View/Smarty');

        require_once('Smarty2622/libs/Smarty.class.php');
        $this->_smarty = new Smarty();
        $this->_smarty->caching = $config->caching;
        $this->_smarty->cache_lifetime = $config->cache_lifetime;
        $this->_smarty->template_dir = PROJECT_ROOT . $config->template_dir;
        $this->_smarty->compile_dir = PROJECT_ROOT . $config->compile_dir;
        $this->_smarty->config_dir = PROJECT_ROOT . $config->config_dir;
        $this->_smarty->cache_dir = PROJECT_ROOT . $config->cache_dir;

        var_dump($this->_smarty);
    }

    public function assign($var)
    {
        /*
        if (is_string($var)) {
            $value = func_get_arg(1);
            $this->_smarty->assign($var, $value);
        }
        elseif (is_array($var)) {
            foreach ($var as $key => $value) {
                $this->_smarty->assign($key, $value);
            }
        } else {
            throw new Zend_View_Exception('assign() expects a string or array, got ' . gettype($var));
        }*/
    }
/*
    protected function _run($template)
    {
        $this->_smarty->display($template);
    }

    public function escape($var)
    {
        if (is_string($var)) {
            return parent::escape($var);
        } elseif (is_array($var)) {
            foreach ($var as $key => $val) {
                $var[$key] = $this->escape($val);
            }
            return $var;
        } else {
            return $var;
        }
    }

    public function output($name)
    {
        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
        header("Cache-Control: no-cache");
        header("Pragma: no-cache");
        header("Cache-Control: post-check=0, pre-check=0", FALSE);
        print parent::render($name);
    }
*/

}